The invention relates generally to digital image scaling whereby a raster image of one particular spatial resolution is converted to a like image having a different spatial resolution. More particularly, the invention relates to a method and apparatus for enlarging gray scale images.
Image scaling is often employed when images created, processed, or stored on one system or device are subsequently transferred for use, display, or output to another device. Image enlarging is especially useful where raster images which require large amounts of computer memory are stored in compressed form and then enlarged for display or hardcopy output.
Various scaling methods are known for enlarging black and white binary images but few of these are useful for gray scale images. Also, many of these methods enlarge an image only by a fixed amount. Finally, the techniques employed often result in many or most of the output data points being generated by the algorithm, resulting in computational inefficiency and possible degradation of image quality.
There is therefore seen a need for a fast and computationally efficient method for enlarging gray scale images by a variable amount. It is also desirable that this method be useful on images having any number of gray levels and that it output images of as good or better quality than those produced using other known techniques. Finally, such method should be easily and conveniently implementable in hardware.
The image scaler of the present invention bidirectionally enlarges gray scale images, comprised of any number of gray scales, by any rational factor expressible as a ratio of integers between 1:1 and 2:1. The method used to perform the scaling is "data conservative" in that it always keeps all of the original gray scale pixel values of the input image, generating additional pixel values as needed to produce an enlarged output image. The image scaler of the invention has two primary components, (1) the method for determining where to insert vacant pixel storage locations needed to produce an enlarged output image and (2) the technique for generating gray scale values for those newly created vacant locations.
To determine where to insert data points an insertion number sequence is generated as a function of the scale factor. The numerical values of the insertion sequence are applied to the image in a repeated fashion such that each pixel and each row of the input image has one sequence value associated with it. The sequence value associated with each pixel or row is interpreted by the scaler as the number of pixel or line units to increment a memory pointer before storing the next pixel value, the address for the next pixel being incremented by the insertion sequence value. Where a storage location is left vacant between original data points, the next pixel value is read and stored at the location specified by the incremented memory pointer, and then a gray scale value for the vacant pixel is calculated and the vacant memory location is filled with the calculated value.
A gray scale value for an inserted pixel is calculated by the scaler as a predetermined function of the current pixel and a previously read and stored pixel. This predetermined function could be simple averaging. For example, in an inserted column, the gray scale values of the two neighboring pixels in the same row could be averaged. For pixels in an inserted row, the neighboring pixels above and below in the same column could be averaged. As the scaler completes the calculations for the values for inserted pixels in a scaled or inserted row, it outputs "words" consisting of a fixed number of adjacent pixels in two parallel outputs, one consisting of an enlarged original row and the other being used to output an added row where necessary.
For a more complete understanding of the invention, its objects and advantages, reference may be had to the following description and the accompanying drawings.